package com.wyw.springcloud.topic;

import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;

/**
 * 文件介绍
 *
 * @Author： Mr Wu （yewen.wu.china.gmail.com）
 * @Date: 2021/3/14 22:25
 */
public interface ErrorTopic {

    String INPUT = "error-consumer";

    String OUTPUT = "error-producer";

    @Input(INPUT)
    SubscribableChannel input();

    //这里直接使用相同名字会报错的哦，
    //org.springframework.beans.factory.BeanDefinitionStoreException:
    // Invalid bean definition with name 'myTopic' defined in com.wyw.springcloud.topic.MyTopic:
    // bean definition with this name already exists
    // - Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.wyw.springcloud.topic.MyTopic; factoryMethodName=input; initMethodName=null; destroyMethodName=null
    @Output(OUTPUT)//不仅仅是通道名称，还是Spring bean
    MessageChannel output();
}
